package com.jghz.framework.base;

import java.io.Serializable;

import org.hibernate.Session;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;

import com.bstek.bdf2.core.orm.hibernate.HibernateDao;

public class BaseDao {

	@Autowired
	private HibernateDao hibernateDao;

	@Autowired
	private JdbcDao jdbcDao;

	public JdbcTemplate getJdbcTemplate() {
		return jdbcDao.getJdbcTemplate();
	}

	public JdbcTemplate getJdbcTemplate(String dataSource) {
		return jdbcDao.getJdbcTemplate(dataSource);
	}

	public Session getSession() {
		return hibernateDao.getSession();
	}

	@SuppressWarnings("unchecked")
	public <T> T get(Class<T> class1, Serializable paramSerializable) {
		return (T) hibernateDao.getSession().get(class1, paramSerializable);
	}

	/** ================以下get,set================ **/

	public HibernateDao getHibernateDao() {
		return hibernateDao;
	}

	public void setHibernateDao(HibernateDao hibernateDao) {
		this.hibernateDao = hibernateDao;
	}

	public JdbcDao getJdbcDao() {
		return jdbcDao;
	}

	public void setJdbcDao(JdbcDao jdbcDao) {
		this.jdbcDao = jdbcDao;
	}

}
